﻿<Window x:Class="AxesDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:oxy="clr-namespace:OxyPlot.Wpf;assembly=OxyPlot.Wpf" 
        Title="AxesDemo" Height="480" Width="640">

    <DockPanel>
        <TabControl Margin="8">
            <TabItem Header="TickStyle">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <oxy:PlotView Title="None" Grid.Row="0" Grid.Column="0">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left" TickStyle="None" MajorGridlineStyle="None" MinorGridlineStyle="None" />
                            <oxy:LinearAxis Position="Bottom" TickStyle="None" MajorGridlineStyle="None" MinorGridlineStyle="None" />
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                    <oxy:PlotView Title="Crossing" Grid.Row="0" Grid.Column="1">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left" TickStyle="Crossing" MajorGridlineStyle="None" MinorGridlineStyle="None" />
                            <oxy:LinearAxis Position="Bottom" TickStyle="Crossing" MajorGridlineStyle="None" MinorGridlineStyle="None"  />
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                    <oxy:PlotView Title="Inside" Grid.Row="1" Grid.Column="0">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left" TickStyle="Inside" MajorGridlineStyle="None" MinorGridlineStyle="None"  />
                            <oxy:LinearAxis Position="Bottom" TickStyle="Inside" MajorGridlineStyle="None" MinorGridlineStyle="None" />
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                    <oxy:PlotView Title="Outside" Grid.Row="1" Grid.Column="1">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left" TickStyle="Outside" MajorGridlineStyle="None" MinorGridlineStyle="None" />
                            <oxy:LinearAxis Position="Bottom" TickStyle="Outside" MajorGridlineStyle="None" MinorGridlineStyle="None"  />
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                </Grid>
            </TabItem>
            <TabItem Header="Gridlines">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <oxy:PlotView Title="None" Grid.Row="0" Grid.Column="0">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left" MajorGridlineStyle="None" MinorGridlineStyle="None" />
                            <oxy:LinearAxis Position="Bottom" MajorGridlineStyle="None" MinorGridlineStyle="None" />
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                    <oxy:PlotView Title="Horizontal" Grid.Row="0" Grid.Column="1">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" />
                            <oxy:LinearAxis Position="Bottom" MajorGridlineStyle="None" MinorGridlineStyle="None" />
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                    <oxy:PlotView Title="Vertical" Grid.Row="1" Grid.Column="0">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left" MajorGridlineStyle="None" MinorGridlineStyle="None" />
                            <oxy:LinearAxis Position="Bottom" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" />
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                    <oxy:PlotView Title="Both" Grid.Row="1" Grid.Column="1">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" />
                            <oxy:LinearAxis Position="Bottom" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" />
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                </Grid>
            </TabItem>
            <TabItem Header="AxisPosition">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <oxy:PlotView PlotMargins="40">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Title="Left" Position="Left" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" />
                            <oxy:LinearAxis Title="Bottom" Position="Bottom" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" />
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                    <oxy:PlotView Grid.Column="1" PlotMargins="40">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Title="Right" Position="Right" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" />
                            <oxy:LinearAxis Title="Top" Position="Top" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" />
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                </Grid>
            </TabItem>
            <TabItem Header="Axis label Angle">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid Grid.Column="1" Background="White">
                        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                            <Slider x:Name="Angle" Orientation="Vertical" 
                           Minimum="-180" Maximum="180" Value="0" Height="200"
                            HorizontalAlignment="Center" />
                            <TextBlock Width="40" TextAlignment="Center" Text="{Binding Value, ElementName=Angle, StringFormat='{}{0:0}º'}" HorizontalAlignment="Center"/>
                        </StackPanel>
                    </Grid>
                    <oxy:PlotView x:Name="AnglePlot1" PlotMargins="60,40,60,30">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Title="Left" Position="Left" Angle="{Binding Value, ElementName=Angle}" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" />
                            <oxy:LinearAxis Title="Bottom" Position="Bottom" Angle="{Binding Value, ElementName=Angle}" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" />
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                    <oxy:PlotView x:Name="AnglePlot2" PlotMargins="60,40,60,30" Grid.Column="2">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Title="Right" Position="Right" Angle="{Binding Value, ElementName=Angle}" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" />
                            <oxy:LinearAxis Title="Top" Position="Top" Angle="{Binding Value, ElementName=Angle}" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" />
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                    <!--<Label Grid.ColumnSpan="3" VerticalAlignment="Center" Foreground="#80000000" FontSize="24" 
                           HorizontalAlignment="Center" Content="TODO: Binding not working..."/>-->
                </Grid>
            </TabItem>
            <TabItem Header="Zero crossing axes">
                <oxy:PlotView PlotAreaBorderThickness="0" PlotMargins="10">
                    <oxy:PlotView.Axes>
                        <oxy:LinearAxis Minimum="-30" Maximum="50" Position="Left" TickStyle="Crossing" PositionAtZeroCrossing="True"/>
                        <oxy:LinearAxis Minimum="-50" Maximum="70" Position="Bottom" TickStyle="Crossing" PositionAtZeroCrossing="True"/>
                    </oxy:PlotView.Axes>
                </oxy:PlotView>
            </TabItem>
            <TabItem Header="Reversed">
                <oxy:PlotView PlotMargins="40 10 10 30" >
                    <oxy:PlotView.Axes>
                        <oxy:LinearAxis Minimum="-30" Maximum="50" Position="Left" StartPosition="1" EndPosition="0"/>
                        <oxy:LinearAxis Minimum="-50" Maximum="70" Position="Bottom" StartPosition="1" EndPosition="0"/>
                    </oxy:PlotView.Axes>
                </oxy:PlotView>
            </TabItem>
            <TabItem Header="4 axes">
                <oxy:PlotView PlotMargins="70,40,40,40">
                    <oxy:PlotView.Axes>
                        <oxy:LinearAxis Position="Left" Minimum="0" Maximum="36" Title="km/h"/>
                        <oxy:LinearAxis Position="Right" Minimum="0" Maximum="10" Title="m/s" MajorGridlineStyle="None" MinorGridlineStyle="None"/>
                        <oxy:LinearAxis Position="Bottom" Minimum="0" Maximum="10" Title="meter"/>
                        <oxy:LinearAxis Position="Top" Minimum="0" Maximum="10000" Title="millimeter"/>
                    </oxy:PlotView.Axes>
                </oxy:PlotView>
            </TabItem>
            <TabItem Header="Multiple axes">
                <oxy:PlotView PlotMargins="40,20,40,30">
                    <oxy:PlotView.Axes>
                        <oxy:LinearAxis Position="Left" Minimum="-1" Maximum="1" Title="C1" StartPosition="0" EndPosition="0.25"/>
                        <oxy:LinearAxis Position="Right" Minimum="-1" Maximum="1" Title="C2" StartPosition="0.25" EndPosition="0.50"/>
                        <oxy:LinearAxis Position="Left" Minimum="-1" Maximum="1" Title="C3" StartPosition="0.5" EndPosition="0.75"/>
                        <oxy:LinearAxis Position="Right" Minimum="-1" Maximum="1" Title="C4" StartPosition="0.75" EndPosition="1.00"/>
                        <oxy:LinearAxis Position="Bottom" Minimum="0" Maximum="100" Title="s"/>
                    </oxy:PlotView.Axes>
                </oxy:PlotView>
            </TabItem>
            <TabItem Header="PositionTier">
                <oxy:PlotView>
                    <oxy:PlotView.Axes>
                        <oxy:LinearAxis Position="Left" Minimum="-1" Maximum="1" Title="PositionTier=0"/>
                        <oxy:LinearAxis Position="Left" Minimum="-2" Maximum="2" Title="PositionTier=1" PositionTier="1" AxislineStyle="Solid"/>
                        <oxy:LinearAxis Position="Right" Minimum="-1" Maximum="1" Title="PositionTier=0"/>
                        <oxy:LinearAxis Position="Right" Minimum="-2" Maximum="2" Title="PositionTier=1" PositionTier="1" AxislineStyle="Solid"/>
                        <oxy:LinearAxis Position="Top" Minimum="-1" Maximum="1" Title="PositionTier=0"/>
                        <oxy:LinearAxis Position="Top" Minimum="-2" Maximum="2" Title="PositionTier=1" PositionTier="1" AxislineStyle="Solid"/>
                        <oxy:LinearAxis Position="Top" Minimum="-10" Maximum="10" Title="PositionTier=2" PositionTier="2" AxislineStyle="Solid"/>
                        <oxy:LinearAxis Position="Bottom" Minimum="-1" Maximum="1" Title="PositionTier=0"/>
                        <oxy:LinearAxis Position="Bottom" Minimum="-2" Maximum="2" Title="PositionTier=1" PositionTier="1" AxislineStyle="Solid"/>
                        <oxy:LinearAxis Position="Bottom" Minimum="-10" Maximum="10" Title="PositionTier=2" PositionTier="2" AxislineStyle="Solid"/>
                    </oxy:PlotView.Axes>
                </oxy:PlotView>
            </TabItem>
            <TabItem Header="Logarithmic axes">
                <oxy:PlotView PlotMargins="80 10 20 30">
                    <oxy:PlotView.Axes>
                        <oxy:LogarithmicAxis Title="Log axis" Minimum="1" Maximum="1e6" Position="Left" UseSuperExponentialFormat="True"/>
                        <oxy:LogarithmicAxis Title="Log axis" Minimum="1e-3" Maximum="1e4" Position="Bottom" UseSuperExponentialFormat="True"/>
                    </oxy:PlotView.Axes>
                </oxy:PlotView>
            </TabItem>
            <TabItem Header="Big numbers">
                <Grid>
                    <oxy:PlotView>
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left" Minimum="-1e47" Maximum="6e32" Title="big numbers"/>
                            <oxy:LinearAxis Position="Bottom" Minimum="-1e40" Maximum="3e50" Title="big numbers"/>
                        </oxy:PlotView.Axes>
                    </oxy:PlotView>
                    <!--<Label VerticalAlignment="Center" Foreground="#80000000" FontSize="24" 
                           HorizontalAlignment="Center" Content="TODO: Where are the 0's coming from?"/>-->
                </Grid>
            </TabItem>
            <TabItem Header="Small numbers">
                <oxy:PlotView>
                    <oxy:PlotView.Axes>
                        <oxy:LinearAxis Position="Left" Minimum="-5e-20" Maximum="6e-20" Title="small numbers"/>
                        <oxy:LinearAxis Position="Bottom" Minimum="-4e-20" Maximum="3e-20" Title="small numbers"/>
                    </oxy:PlotView.Axes>
                </oxy:PlotView>
            </TabItem>
            <TabItem Header="Padding">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <oxy:PlotView Title="Default padding" Grid.Row="0" Grid.Column="0">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left"/>
                            <oxy:LinearAxis Position="Bottom"/>
                        </oxy:PlotView.Axes>
                        <oxy:PlotView.Series>
                            <oxy:LineSeries ItemsSource="{Binding Data1}" DataFieldX="X" DataFieldY="Y"/>
                        </oxy:PlotView.Series>
                    </oxy:PlotView>
                    <oxy:PlotView Title="No padding" Grid.Row="0" Grid.Column="1">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left" MinimumPadding="0" MaximumPadding="0"/>
                            <oxy:LinearAxis Position="Bottom" MinimumPadding="0" MaximumPadding="0"/>
                        </oxy:PlotView.Axes>
                        <oxy:PlotView.Series>
                            <oxy:LineSeries ItemsSource="{Binding Data1}" DataFieldX="X" DataFieldY="Y"/>
                        </oxy:PlotView.Series>
                    </oxy:PlotView>
                    <oxy:PlotView Title="Padding 10%" Grid.Row="0" Grid.Column="2">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left" MinimumPadding="0.1" MaximumPadding="0.1"/>
                            <oxy:LinearAxis Position="Bottom" MinimumPadding="0.1" MaximumPadding="0.1"/>
                        </oxy:PlotView.Axes>
                        <oxy:PlotView.Series>
                            <oxy:LineSeries ItemsSource="{Binding Data1}" DataFieldX="X" DataFieldY="Y"/>
                        </oxy:PlotView.Series>
                    </oxy:PlotView>
                    <oxy:PlotView Title="X-axis MinimumPadding=0.1" Grid.Row="1" Grid.Column="0">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left"/>
                            <oxy:LinearAxis Position="Bottom" MinimumPadding="0.1"/>
                        </oxy:PlotView.Axes>
                        <oxy:PlotView.Series>
                            <oxy:LineSeries ItemsSource="{Binding Data1}" DataFieldX="X" DataFieldY="Y"/>
                        </oxy:PlotView.Series>
                    </oxy:PlotView>
                    <oxy:PlotView Title="X-axis MaximumPadding=0.1" Grid.Row="1" Grid.Column="1">
                        <oxy:PlotView.Axes>
                            <oxy:LinearAxis Position="Left"/>
                            <oxy:LinearAxis Position="Bottom" MaximumPadding="0.1"/>
                        </oxy:PlotView.Axes>
                        <oxy:PlotView.Series>
                            <oxy:LineSeries ItemsSource="{Binding Data1}" DataFieldX="X" DataFieldY="Y"/>
                        </oxy:PlotView.Series>
                    </oxy:PlotView>
                </Grid>
            </TabItem>
            <TabItem Header="Context menu">
                <oxy:PlotView>
                    <oxy:PlotView.ContextMenu>
                        <ContextMenu>
                            <MenuItem Header="This is a"/>
                            <MenuItem Header="context menu!"/>
                        </ContextMenu>
                    </oxy:PlotView.ContextMenu>
                    <oxy:PlotView.Axes>
                        <oxy:LinearAxis Position="Left"/>
                        <oxy:LinearAxis Position="Bottom"/>
                    </oxy:PlotView.Axes>
                </oxy:PlotView>
            </TabItem>
        </TabControl>
    </DockPanel>
</Window>
